<script language="Javascript">

// Gets a element by its Id. Used for shorter coding.
function GetE( elementId )
{
	return document.getElementById( elementId )  ;
}

function ShowE( element, isVisible )
{
	if ( typeof( element ) == 'string' )
		element = GetE( element ) ;
	element.style.display = isVisible ? '' : 'none' ;
}

function SetAttribute( element, attName, attValue )
{
	if ( attValue == null || attValue.length == 0 )
		element.removeAttribute( attName, 0 ) ;			// 0 : Case Insensitive
	else
		element.setAttribute( attName, attValue, 0 ) ;	// 0 : Case Insensitive
}

      function AddImage() {

        var width = screen.width*0.7;
		var height = screen.height*0.7;

		var iLeft = (screen.width  - width) / 2 ;
        var iTop  = (screen.height - height) / 2 ;

        var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ;
		sOptions += ",width=" + width  ;
		sOptions += ",height=" + height ;
		sOptions += ",left=" + iLeft ;
		sOptions += ",top=" + iTop ;

		var path = '/{$#app_name}/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php';
   		window.open(path, "FCKBrowseWindow", sOptions ) ;
      }

      function SetUrl( fileUrl ) {
          	document.forms[0].photo_url.value=fileUrl;
          	var picture = GetE('img_picture_url');
          	if (picture) SetAttribute( picture, 'src', fileUrl );
          	var size_element =  GetE('size');
          	if (size_element) size_element.style.visibility = 'hidden';
      }
</script>

<form id="PlayerForm" name="PlayerForm" method="post" action="" runat="server">
<input name="player_id" type="hidden" id="player_id" runat="server">
<input name="page" type="hidden" id="page" runat="server">
<hr>

<core:optional for="msg">
	<span class="message" runat="server"> {$msg} </span>
</core:optional>
<table width="100%" border="0" align="center" cellspacing="2" cellpadding="3">
<tr><td colspan="2" class="textlogin" style="font-size:10pt;left-pedding:20;padding-bottom:5;">Note: Fields marked with asterick (<font color="red">*</font>) are obligatory</td></tr>
    <tr align="left">
    	<td class="whiteheader_center">
    		<core:optional for="player_id">
    			Edit the player (ID: {$player_id})
            </core:optional>
            <core:default for="player_id">
            	Create a new player
            </core:default>
         </td>
         <td class="whiteheader">
            <a href="/{$#app_name}/myprofile/index.htm"> My Profile </a> &nbsp;
            <core:optional for="staff_user">
            <html:link url="/">All players</html:link>
           	</core:optional>
            <core:default for="staff_user">
            <a href="/{$#app_name}/players/index.htm"> All players </a>
           	</core:default>
          </td>
     </tr>

    <core:default for="supress_errors">
    <ERRORSUMMARY id='Summary' runat="server">
        <tr valign="top">
          <td width="{$width}">Errors: &nbsp;</td>
          <td class="left">
          	<FONT COLOR="RED">
          		<list:ITEM> {$ErrorMessage} &nbsp; </list:ITEM>
          	</FONT>
          </td>
        </tr>
     </ERRORSUMMARY>
     </core:default>

     <tr>
     	<td class="small" colspan="2">
     		<core:optional for="player_id">
     			Enter your changes to the information below to edit an existing content item.
     			When you are finished, press the Save button.
            </core:optional>
     	</td>
     </tr>

     <core:optional for="player_id">
     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="date_added" runat="server">Date Posted:</label>
       </td>
       <td class="form_field">
         <span class="small"> {$date_added} </span>
       </td>
     </tr>
     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="author" runat="server">Author:</label>
       </td>
       <td class="form_field">
         <span class="small"> {$firstname} {$lastname}, {$title} </span>
       </td>
     </tr>
     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="url" runat="server">URL:</label>
       </td>
       <td class="form_field">
         <span class="small"> /{$#app_name}/pub.player.php?id={$player_id} </span>
       </td>
     </tr>
     </core:optional>

     <core:optional for="staff_user">
     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="published" runat="server">Approved/Published</label>
       </td>
       <td class="form_field">
         <input name="published" type="checkbox" id="published" value="1" runat="server">
       </td>
     </tr>
  <!--   <hr>-->

  	<tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="premium" runat="server">Premium Item</label>
       </td>
       <td class="form_field">
         <input name="premium" type="checkbox" id="premium" value="1" runat="server">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="premium" runat="server">Premium Video Highlight</label>
       </td>
       <td class="form_field">
         <input name="premiumVideo" type="checkbox" id="premiumVideo" value="1" runat="server">
       </td>
     </tr>
     </core:optional>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="category_id" runat="server">Sport category</label>
       </td>
       <td class="form_field">
      	 <select name='category_id' id='category_id' runat="server">
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="category2_id" runat="server">Community category</label>
       </td>
       <td class="form_field">
      	 <select name='category2_id' id='category2_id' runat="server">
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="gender" runat="server">Gender</label>
       </td>
       <td class="form_field">
         <select name='gender' id='gender' runat="server">
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="height" runat="server">
      	 	Player height:
      	 </label>
       </td>
       <td class="form_field">
         <input name="height" type="text" id="height" size="6" displayname="Player height">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="weight" runat="server">
      	 	Player weight:
      	 </label>
       </td>
       <td class="form_field">
         <input name="weight" type="text" id="weight" size="6" displayname="Player weight">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="class" runat="server"><font color="red">*</font>Class</label>
       </td>
       <td class="form_field">
         <select name='class' id='class' runat="server" >
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="name" runat="server">
      	 	<font color="red">*</font>Player name:
      	 </label>
       </td>
       <td class="form_field">
         <input name="name" type="text" id="name" size="64" displayname="Player name">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="name" runat="server">
      	 	Player position:
      	 </label>
       </td>
       <td class="form_field">
         <input name="position" type="text" id="position" size="32">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="small_picture" runat="server">
      	 	Player photo:
      	 </label>
       </td>
       <td class="form_field">
         <table>
         <tr>
         	<td>
            	<core:optional for="photo_url">
           			<a id="a_picture_url" name="a_picture_url" href="{$photo_url}">
             			<img id="img_picture_url" name="img_picture_url" src="{$photo_url}" border="0"/>
           			</a> <br>
           			<div id="size" name="size">
           				Size: {$photo_width}*{$photo_height} <br>
           			</div>
                </core:optional>

                <core:default for="photo_url">
                   <img id="img_picture_url" name="img_picture_url" src="/{$#app_name}/images/1x1.gif" border="0"/>
           		   <br>
                </core:default>

                <input name="photo_url" type="text" id="photo_url" runat="server" size="64">
                <BUTTON name="add_image" style="width:150;" class="form_button" onclick="AddImage();">Add/Change image</BUTTON>
         	</td>
            <td>
            </td>
         </tr>
         </table>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="contact_phone" runat="server" >
      	 	Phone contact #:
      	 </label>
       </td>
       <td class="form_field">
         <input name="contact_phone" type="text" id="contact_phone" size="32" displayname="Contact phone">
       </td>
     </tr>

     <!--School -->
     <tr valign="top">
       <td colspan="2" width="{$width}" class="left">
         <table width="350" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="3" class="left">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="1%">
                      	<img src="/{$#app_name}/images/borders/boxcnlt.gif" width="21" height="20"></td>
                      <td valign="top" background="/{$#app_name}/images/borders/titlebg.gif" class="left" width="100%">
						<b>&nbsp; School </b></td>
                      <td valign="bottom" bgcolor="#FFFFFF" align="right" width="1%">
						<img src="/{$#app_name}/images/borders/boxcnrt2.gif" width="6" height="6"></td>
                    </tr>
                </table>
              	</td>
              </tr>
              <tr>
                <td background="/{$#app_name}/images/borders/newsboxside.gif" width="1">
					<img src="/{$#app_name}/images/1x1.gif" width="1" height="1">
		    	</td>
                <td class="left">
                	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="/{$#app_name}/images/1x1.gif" width="10" height="1"></td>
                      <td class="left">
                      	<table width="100%"  border="0" cellspacing="0" cellpadding="0">

                          <tr valign="top">
       						<td class="form_label" width="{$width}">
      	 						<label for="school_name" runat="server">
      	 							Name:
      	 						</label>
       						</td>
       						<td class="form_field">
         						<input name="school_name" type="text" id="school_name" size="64">
       						</td>
     					  </tr>

                          <tr valign="top">
       						<td class="form_label" width="{$width}" nowrap>
      	 						<label for="school_address" runat="server">
      	 							Street address:
      	 						</label>
       						</td>
       						<td class="form_field">
         						<input name="school_address" type="text" id="school_address" size="64">
       						</td>
     					  </tr>

                          <tr valign="top">
       						<td class="form_label" width="{$width}">
      	 						<label for="school_city" runat="server">
      	 							City:
      	 						</label>
       						</td>
       						<td class="form_field">
         						<input name="school_city" type="text" id="school_city" size="32">
       						</td>
     					  </tr>

                          <tr valign="top">
       						<td class="form_label" width="{$width}">
      	 						<label for="school_state" runat="server">
      	 							State:
      	 						</label>
       						</td>
       						<td class="form_field">
                              <select name='school_state' id='school_state' runat="server">
	 						  </select>
       						</td>
     					  </tr>

                          <tr valign="top">
       						<td class="form_label" width="{$width}">
      	 						<label for="school_zip" runat="server">
      	 							Zip:
      	 						</label>
       						</td>
       						<td class="form_field">
         						<input name="school_zip" type="text" id="school_zip" size="9" displayname="School zip">
       						</td>
     					  </tr>



                      	</table>
                      </td>
                      <td><img src="/{$#app_name}/images/1x1.gif" width="10" height="1"></td>
                    </tr>
                	</table>
                </td>
                <td width="1" background="/{$#app_name}/images/borders/newsboxside.gif" class="left">
					<img src="/{$#app_name}/images/1x1.gif" width="1" height="1">
				</td>
              </tr>
              <tr>
                <td colspan="3" class="left">
                	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    	<tr>
                      		<td width="11"><img src="/{$#app_name}/images/borders/boxcnlb.gif" width="11" height="13"></td>
                      		<td background="/{$#app_name}/images/borders/boxhlb.gif">&nbsp;</td>
                      		<td width="11">
                      			<img src="/{$#app_name}/images/borders/boxcnrb.gif" width="11" height="13">
                      		</td>
                    	</tr>
                	</table>
                </td>
              </tr>

         </table>
       </td>
     </tr>

     <!-- Coach -->
     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="coach_name" runat="server">
      	 	Coach name:
      	 </label>
       </td>
       <td class="form_field">
         <input name="coach_name" type="text" id="coach_name" size="32">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="coach_phone" runat="server">
      	 	Coach phone:
      	 </label>
       </td>
       <td class="form_field">
         <input name="coach_phone" type="text" id="coach_phone" size="32" displayname="Coach phone">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="team" runat="server">Team:</label>
       </td>
       <td class="form_field">
      	 <select name='team' id='team' runat="server">
	 	 </select>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" colspan="1">
      	 <label runat="server">Description:</label>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_field" colspan="2">
      	 <textarea name="description" id="description" runat="server" cols="80" rows="5"> </textarea>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" colspan="1">
      	 <label runat="server">Why should player be added to the "Official List"?</label>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_field" colspan="2">
      	 <textarea name="why_official_list" id="why_official_list" runat="server" cols="80" rows="5"> </textarea>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="gpa" runat="server">Grade Point Average:</label>
       </td>
       <td class="form_field">
         <input name="gpa" type="text" id="gpa" size="8" displayname="GPA"> %
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="sat" runat="server">SAT score(if available):</label>
       </td>
       <td class="form_field">
         <input name="sat" type="text" id="sat" size="8" displayname="SAT">
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" width="{$width}">
      	 <label for="projected_level" runat="server">Projected College level:</label>
       </td>
       <td class="form_field">
      	 <select name='projected_level' id='projected_level' runat="server">
	 	 </select>  	 	 Answered by Coaches only
       </td>
     </tr>

     <tr valign="top">
       <td class="form_label" colspan="1">
      	 <label runat="server">If yes, then which have shown interest and which have made offers</label>
       </td>
     </tr>

     <tr valign="top">
       <td class="form_field" colspan="2">
      	 <textarea name="interest_offers" id="interest_offers" runat="server" cols="80" rows="5"> </textarea>
       </td>
     </tr>

     <tr>
      <td class="whiteheader_center" colspan="2">&nbsp;</td>
     </tr>

	 <tr>
      <td>&nbsp;</td>
      <td class="form_field">

      		<core:default for="player_id">
      			<input type="submit" name="create" value="Create" runat="server">
            </core:default>
            <core:optional for="player_id">
      			<input type="submit" name="save" value="Save" runat="server">
                <!--<input type="submit" name="delete" value="Delete" runat="server">-->
            </core:optional>
            <input type="submit" name="clean" value="Clean" runat="server">
            <input type="submit" name="players" value="Back to players" runat="server">
            <core:optional for="player_id">
                <br>
                <a href="/{$#app_name}/pub.player.php?player_id={$player_id}" target="__blank">
                  Preview
                </a>
                <span class="small">
                	Before hitting Preview, make sure that you saved the player information
      	 		</span>
            </core:optional>
      </td>
</tr>

</table>
</form>